package com.qianfeng.wuyang.himalaya.adapter.recommendfocusadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.qianfeng.wuyang.himalaya.R;
import com.qianfeng.wuyang.himalaya.bean.recommendfocusbean.ListFocus;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;

import java.util.List;

/**
 * Created by Administrator on 2016/12/12.
 */

public class RecommendFocusCommentAdapter extends BaseAdapter {
    private List<List<ListFocus>> list;
    private Context context;
    private LayoutInflater inflater;

    public RecommendFocusCommentAdapter(List<List<ListFocus>> list, Context context) {
        this.list = list;
        this.context = context;
        inflater=LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list.get(0).size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        VierHolder holder;
        if(view==null){
            view=inflater.inflate(R.layout.recommended_focus_comment,viewGroup,false);
            holder=new VierHolder(view);
            view.setTag(holder);

        }else{
            holder= (VierHolder) view.getTag();
        }
        holder.recommendedFocusComment5.setText(list.get(0).get(i).getContent());
        holder.recommendedfocuscommentNumber.setText(list.get(0).get(i).getLikes()+"");
        holder.recommendedFocusCommentText3.setText(list.get(0).get(i).getNickname());
        RequestCreator creator = Picasso.with(context)
                .load(list.get(0).get(i).getSmallHeader());
        creator.transform(new CircleTransformation());
        creator.into(holder.recommenedFocusComment5);
        return view;
    }
    public static class VierHolder{
     ImageView recommenedFocusComment5;
        TextView recommendedFocusCommentText3;
        TextView recommendedFocusComment5,recommendedfocuscommentNumber;

        public VierHolder(View view) {
            super();
            recommenedFocusComment5= (ImageView) view.findViewById(R.id.recommenedFocusComment5);
            recommendedFocusCommentText3= (TextView) view.findViewById(R.id.recommendedFocusCommentText3);
            recommendedFocusComment5= (TextView) view.findViewById(R.id.recommendedFocusComment5);
            recommendedfocuscommentNumber= (TextView) view.findViewById(R.id.recommendedfocuscommentNumber);

    }
    }
}
